<template>
     <header class="header">
      <h1>小黑记事本</h1>
      <input @keyup.enter="add" placeholder="请输入任务" class="new-todo" v-model.trim="title"/>
      <button class="add" @click="add">添加任务</button>
    </header>
</template>
<script>
export default {
    data() {
        return {
            title: ''
        }  
    },
    // props: ['title'],
    methods: {
        add() {
            this.$emit('add', this.title)
            this.title=''
        }
    }
}
</script>